package com.training;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class TestServlet
 */
public class TestServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public TestServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see Servlet#init(ServletConfig)
	 */
	public void init(ServletConfig config) throws ServletException {
		System.out
				.println("*****************I am inside INIT********************");
	}

	/**
	 * @see Servlet#destroy()
	 */
	public void destroy() {
		System.out.println("********************IN Destroy*******************");
	}

	@Override
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		String name = request.getParameter("name22");
		String password = request.getParameter("password22");

		PrintWriter writer = response.getWriter();
		response.setContentType("text/html");
		writer.println(" <html> <body bgcolor='blue'> <h1> Hello User - Your user Name is - "
				+ name
				+ " Password is   "
				+ password
				+ ""
				+ "  </h1> <h3> It is visible to everyone </h3> </body></html> ");

	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

	}

}
